home *** CD-ROM | disk | FTP | other *** search
/ Aminet 23 / Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso / Aminet / util / cli / LibMon.lha / Src / load.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-10-28  |  1.1 KB  |  60 lines

  1. #include <exec/types.h>
  2. #include <exec/libraries.h>
  3. #include <dos/dos.h>
  4. #include <clib/exec_protos.h>
  5. #include <clib/dos_protos.h>
  6.  
  7. #include <stdio.h>
  8.  
  9. #include "global.h"
  10. #include "break.h"
  11. #include "load.h"
  12.  
  13. /*
  14. ** Load the specified library
  15. */
  16. void LoadLib(STRPTR LibName, BOOL Report)
  17. {
  18.   struct Library *Library;
  19.   
  20.   Library = OldOpenLibrary(LibName);
  21.   if (Library)
  22.   {
  23.     printf("%s v%d.%d loaded.\n",LibName,
  24.                                  Library->lib_Version,
  25.                                  Library->lib_Revision);
  26.     CloseLibrary(Library);
  27.   }
  28.   else if (Report)
  29.     fprintf(stderr,"Couldn't open %s.\n",LibName);
  30. }
  31.  
  32. /*
  33. ** Load all libraries in the LIBS: assignment
  34. */
  35. void LoadLibs(void)
  36. {
  37.   BPTR LibsLock;
  38.   struct FileInfoBlock LibsFIB;
  39.   
  40.   LibsLock = Lock("LIBS:",SHARED_LOCK);
  41.   if (!LibsLock)
  42.     fputs("LIBS: is not available!\n",stderr);
  43.   else
  44.   {
  45.     Examine(LibsLock,&LibsFIB);
  46.     
  47.     while (ExNext(LibsLock,&LibsFIB))
  48.     {
  49.       LoadLib(LibsFIB.fib_FileName,QUIET);
  50.       if (CTRL_C)
  51.       {
  52.         fputs(BREAK_TXT,stderr);
  53.         break;
  54.       }
  55.     }
  56.     
  57.     UnLock(LibsLock);
  58.   }
  59. }
  60.